#include "stdafx.h"
#include "CmdDef.h"
#include "CmdMgr.h"
#include "../ConstStr/ConstStr.h"

using namespace Base::CmdFwk;

CmdDef::CmdDef(const std::string& name)
    : m_id(Base::ConstStr::ConstStr::get()->string(name))
{
}

CmdDef::~CmdDef()
{
}

const void*
CmdDef::id() const
{
    return m_id;
}

void
CmdDef::environments(const std::vector<const void*>& environments)
{
    m_environments = environments;
}

const std::vector<const void*>&
CmdDef::environments() const
{
    return m_environments;
}

bool
CmdDef::isInEnv(const void* envId) const
{
    std::vector<const void*>::const_iterator it 
        = std::find(m_environments.begin(), m_environments.end(), envId);
    return (it != m_environments.end());
}